#include <stdio.h>

/*
 * 地址的问题，主要注意两点
 * 1.指针的地址
 * 2.数组的地址
 *
 */
struct {} a;
struct {char c} b;

int main(void)
{

	int a[] = {1, 2, 3, 4};
	printf("a[] = {1, 2, 3, 4}:\n");
	printf("address: 0x%x 0x%x 0x%x 0x%x",
			&a[0], &a[1], &a[2], &a[3]);
	printf("\tvalue of a: 0x%x\n", a);
	printf("\tadress of a: 0x%x\n", &a);
	printf("\taddress of a[0]: 0x%x\n", &a[0]);
	printf("\tvalue of a+1: 0x%x\n", a+1);
	printf("\tvalue of &a+1: 0x%x\n", &a+1);

	int* p1 = &a;
	printf("*p1 = {1, 2, 3, 4}:\n");
	printf("\tvalue of p1: 0x%x\n", p1);
	printf("\tadress of p1: 0x%x\n", &p1);
	printf("\taddress of p1[0]: 0x%x\n", &p1[0]);
	printf("\tvalue of p1+1: 0x%x\n", p1+1);
	printf("\tvalue of &p1+1: 0x%x\n", &p1+1);//注意这个地方，由于&p1是一个地址，所以&pa+1也会将加一个地址，由于系统是64位系统，所以地址8字节，所以结果是加了8个字节
	//在32位系统上，地址是4字节，所以会增加4字节
	//应该可以归纳
	//对 T a; &a + 1 == &a + sizeof(a)
	return 0;
}
